package pingu.interface_graphique;

import org.newdawn.slick.Color;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.Image;
import org.newdawn.slick.geom.Polygon;
import org.newdawn.slick.geom.Transform;
import org.newdawn.slick.gui.MouseOverArea;

public class HexagonalButton{

	private Image image;
	private MouseOverArea mouseOverHexa;
	private GameContainer container;
	private int xCase;
	private int yCase;

	public HexagonalButton(GameContainer gc,Image image,int x,int y,float scale,int xCase,int yCase){
		if(image!=null)this.image=image.getScaledCopy(scale);
		this.container=gc;
		this.setxCase(xCase);
		this.setyCase(yCase);
		Polygon hexa=new Polygon();
		hexa.addPoint(2, 29);
		hexa.addPoint(50, 1);
		hexa.addPoint(97, 29);
		hexa.addPoint(97, 84);
		hexa.addPoint(50, 113);
		hexa.addPoint(1, 84);
		
		Transform myTransform=new Transform(Transform.createScaleTransform(scale, scale));
		mouseOverHexa=new MouseOverArea(container,this.image ,hexa.transform(myTransform));
		mouseOverHexa.setLocation(x, y);
		}
	
	public boolean mouseOver(){
		return mouseOverHexa.isMouseOver();
	}
	
	public void render(Graphics g){
		mouseOverHexa.render(container, g);
	}

	public void setxCase(int xCase) {
		this.xCase = xCase;
	}

	public int getxCase() {
		return xCase;
	}

	public void setyCase(int yCase) {
		this.yCase = yCase;
	}

	public int getyCase() {
		return yCase;
	}
	
}
